﻿using BLL;
using models;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace yuejilalala
{
    public partial class success : System.Web.UI.Page
    {
        OrderManager orderManager= new OrderManager();
        CartMarager cartMarager = new CartMarager();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                userDl();
                //跳转到这个界面就代表着付款成功将物品改成已付款
                Pay pay= Session["PaySum"] as  Pay; //接受价格123
                lb_price.Text = pay.ProPrice.ToString();//显示价格
                string ddh = Session["ddh"].ToString();//获取订单号
                orderManager.UporderByIdIsState(ddh);//执行修改
                Address address = Session["dizhi"] as Address; //地址查看
                lb_shr.Text = address.Name;
                lb_lxdh.Text = address.Phone.ToString(); ;
                lb_shdz.Text = address.Addres;
                //判定用户是否登陆 登陆显示购物车内容总数
                if (Session["sessid"] != null)
                {

                    J_MiniCartNum.Text = cartMarager.CartCount((Session["sessid"].ToString())).ProPrice.ToString();//显示出购物车内物品.数量
                }
            }
            
        }
        //登陆在左上方显示用户名方法					
        public void userDl()
        {
            if (Session["sess"] != null)
            {
                //用户存在则显示出来 并且隐藏注册和登陆显示
                User user = Session["sess"] as User;
                hl_dlm.Text = "用户名:" + user.UName;
                hl_dlm.Visible = true;//显示登陆名控件
                hl_dl.Visible = false;//请登陆隐藏
                hl_zc.Visible = false;//注册隐藏
            }

        }
    }
}